#! /usr/bin/env python3


def guest_list()->None:
    """输出欢迎语，并将访客保存至文件"""
    flag = True
    while flag:
        name = input("请输入你的姓名：")
        if name in ('q', 'quit', 'exit'):
            break
        print(f"欢迎{name}访问该页面...")
        with open('guest_book.txt', 'a', encoding='utf-8') as f:
            f.write(f"{name}\n")


guest_list()
